function quickSort(arr) {
    if (arr === null) return
    if (arr.length === 0) return []

    let left = []
    let right = []

    let active = arr[0]
    for (let i = 1; i < arr.length; i++) {
        if (arr[i] < active) left.push(arr[i])
        else right.push(arr[i])
    }
    
    left = arguments.callee(left)
    right = arguments.callee(right)
    left.push(active)
    return left.concat(right)

}

let arr = [3, 4, 8, 1, 2, 5, 9, 7, 6]

console.log(quickSort(arr));